import { getTreeChannelApi } from "@/api/configCenter/warehouseEntryChannel";
import { reactive } from "vue";
export const searchItemList: Array<SuperSearch.SearchItem> = [
  reactive<SuperSearch.SearchItem>({
    type: "cascader",
    label: "渠道",
    keyName: "id",
    optionsRequest: getTreeChannelApi,
    optReqCb: (res: Base.GeneraDataType, row: SuperSearch.SearchItem) => {
      const { code, data } = res;
      if (code === 200) {
        row.options = data || [];
      }
    },
    optConfig: {
      label: "label",
      value: "value",
      children: "children"
    },
    options: []
  }),
  {
    type: "dict-select",
    label: "派送方式",
    keyName: "deliveryType",
    lookupCode: "DELIVERY_METHOD",
    optConfig: {
      label: "name",
      value: "code"
    },
    options: []
  },
  {
    type: "dict-select",
    label: "多件计重单位",
    keyName: "multipleWeightingMethod",
    lookupCode: "MULTIPLE_WEIGHT_METHOD",
    optConfig: {
      label: "name",
      value: "code"
    },
    options: []
  },
  {
    type: "select",
    label: "状态",
    keyName: "status",
    optConfig: {
      label: "label",
      value: "value"
    },
    options: [
      {
        label: "启用",
        value: 1
      },
      {
        label: "停用",
        value: 0
      }
    ]
  }
];

// 列表
export const tableColumn: Array<SuperTable.TableCoulmnItem | SuperTable.NestTableColumnItem> = [
  {
    field: "channelName",
    title: "渠道名称",
    minWidth: "140"
  },
  {
    field: "channelAllocation",
    title: "渠道分类",
    minWidth: "120",
    renderSlot: "channelAllocation"
  },
  {
    field: "deliveryType",
    title: "派送类型",
    minWidth: "120",
    renderSlot: "deliveryType"
  },
  {
    field: "countingRatio",
    title: "计泡系数",
    minWidth: "120"
  },
  {
    field: "multipleWeightingMethod",
    title: "多件计重方式",
    minWidth: "120",
    renderSlot: "multipleWeightingMethod"
  },
  {
    field: "taxPaymentMethodName",
    title: "交税方式",
    minWidth: "120"
  },
  {
    field: "status",
    title: "状态",
    minWidth: "90",
    renderSlot: "status"
  },
  {
    field: "action",
    title: "操作",
    minWidth: "180",
    renderSlot: "action"
  }
];
